package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.ShippedBoxSkus;

public interface ShippedBoxSkusDao extends
		JpaSpecificationExecutor<ShippedBoxSkus>,
		PagingAndSortingRepository<ShippedBoxSkus, Long> {
	
	@Modifying
	@Query("delete from ShippedBoxSkus sb where sb.batchCode=?1")
	void delete(String batchCode);
	
	@Modifying
	@Query("update ShippedBoxSkus s set s.realQty=?1 where s.id=?2")
	void updateRealQty(int realQty,Long id);


	List<ShippedBoxSkus> findByBoxCode(String boxCode);
	
	List<ShippedBoxSkus> findByBoxCodeAndBackupTaskCode(String boxCode,String backupTaskCode);
	
	List<ShippedBoxSkus> findByBackupTaskCode(String backupTaskCode);
	
	List<ShippedBoxSkus> findByBoxCodeAndBatchCode(String boxCode,String batch);
	
	List<ShippedBoxSkus> findByBatchCodeAndSkuId(String batchCode,String skuId);
	
	ShippedBoxSkus findByBoxCodeAndSkuId(String boxCode,String skuId);
	
}
